home *** CD-ROM | disk | FTP | other *** search
- #!/usr/local/bin/wish -file
-
- #
- # $Id: entryDialog,v 1.3 1993/11/16 22:19:20 jason Exp $
- #
-
- proc Lc {s} {return $s}
-
- proc EntryDialog {type t msg} {
- global EntryDialog_Value
- catch {destroy .EntryDialog}
- $type $t -borderwidth 4 -relief sunken
- message $t.msg -text $msg -aspect 99999
- entry $t.e -width 50 -borderwidth 2 -relief sunken
- frame $t.bar
- button $t.bar.ok -text [Lc "OK"] \
- -command "global EntryDialog_Value
- set EntryDialog_Value \[$t.e get\]
- destroy $t"
- button $t.bar.cancel -text [Lc "Cancel"] \
- -command "global EntryDialog_Value exitVal
- set exitVal 1; set EntryDialog_Value {}
- destroy $t"
- pack append $t.bar \
- $t.bar.ok {left padx 8 pady 8} \
- $t.bar.cancel {right padx 8 pady 8}
- pack append $t \
- $t.msg {top fillx} \
- $t.e {top padx 8 pady 8} \
- $t.bar {bottom fillx}
- bind . <ResizeRequest> {
- wm geometry . 0x0+%x+%y; update
- }
- bind $t <Visibility> "grab -global $t; focus $t.e"
- bind $t.e <KeyPress-Return> " "
- bind $t.e <Enter> "+focus $t.e"
- pack $t -expand true -fill both
- }
- set EntryDialog_Value ""
- set exitVal 0
- wm title . ""
- wm minsize . 300 80
- set msg ""
- foreach m $argv { append msg "$m " }
- set msg [string trimright $msg " "]
- EntryDialog frame .ed $msg
- tkwait window .ed
- puts stdout "[string trimright $EntryDialog_Value "\t \n"]"
- exit $exitVal
-